﻿<!DOCTYPE html>
<html>
<head>
    <title></title>
    Properties: selected-row
</head>
<body>
    <div>

    </div>
    <script>
        "use strict";
        "k_grid_view.html";
        $tmp.dataSource = new kendo.data.DataSource({
            data: [],
            change: function (e) {
                var f = e.action;
                
            }
        });
        if ($tmp.$a.dock == "full") {
            $tmp.$height = $(window).height() - 240;
        }
        $tmp.kGrid= $($tmp.$e[0]).kendoGrid({
            sortable: true,
            filterable: true,
            groupable: true,
            //navigatable: true,
            selectable: true,
            height: $tmp.$height
        }).data("kendoGrid");
        
        $tmp.$a.$observe("ngColumns", function (cols) {
            var f = $tmp.$s.$eval(cols);
            $tmp.kGrid.destroy();
            $tmp.kGrid = $($tmp.$e[0]).kendoGrid({
                sortable: true,
                columns: f,
                filterable: true,
                groupable: true,
                //navigatable: true,
                selectable: true,
                height: $tmp.$height,
                change: function(e) {
                    var selectedRows = this.select();
                    $tmp.selectedRow = this.dataItem(selectedRows);
                    if ($tmp.$a.selectedRow) {
                        ngW8.$("$parse")($tmp.$a.selectedRow)($tmp.$s, $tmp.selectedRow);
                    }
                }
            
            }).data("kendoGrid");
        });
        $tmp.$s.$watch($tmp.$a.source, function (n, o) {
            if (angular.isUndefined(n)) return;
            if (n != o) {
                $tmp.dataSource.data(n);
                $tmp.kGrid.setDataSource($tmp.dataSource);
            }
        });
        if ($tmp.$a.dock == "full") {
            $($tmp.$e[0]).css("position", "fixed");
            $($tmp.$e[0]).css("left", "120px");
            $($tmp.$e[0]).css("top", "120px");
            $($tmp.$e[0]).css("right", "0px");
            $($tmp.$e[0]).css("bottom", "90px");
            $tmp.$height = $(window).height() - 240;
        }
    </script>
</body>
</html>